//
//  Language.h
//  zoudasmallworld
//
//  Created by 周俊 on 14-10-31.
//
//
//文件编码UTF-8
#ifndef _LANG_H_
#define _LANG_H_

#include <string>
#include <vector>
#include <unordered_map>

#include "Macro.h"

TSP_NS_START

class Language
{
public:

    static const char* FILE_NOT_EXIST;

    enum LangName
    {
        kLangUnknown = 0,
        kLangChinese,
        kLangEnglish,
        kLangJapanese,
        kLangMax
    };

    ~Language();

    //static functions
    static Language* getInstance();
    static const char* getString(const char* key);

    //normal public functions
    inline LangName getLanguage()
    {
        return m_currentLanguage;
    }

    int setLanguage(LangName langName);
    int loadFile(LangName langName, const char* language_file);

protected:
    Language();

    LangName m_currentLanguage;
    std::unordered_map<std::string, std::string>* m_pCurrentTransferor;
    std::unordered_map<int, std::unordered_map<std::string, std::string>*> m_transferors;

private:
    TSP_DISALLOW_COPY_AND_ASSIGN(Language);
};

#define Lang(key) TSP::Language::getString(key)

TSP_NS_END
#endif /* _LANG_H_ */
